﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZBJF.Warranty.Model;

namespace ZBJF.Warranty.BLL
{
    public partial class InsuranceProductsAvailableScreenTypeService
    {

        /// <summary>
        /// 获取可承保屏幕类型列表
        /// </summary>
        /// <param name="cellPhoneServiceProjectID">保险产品手机服务项目ID</param>
        /// <returns></returns>
        public List<InsuranceProductsAvailableScreenType> GetInsuranceProductsAvailableScreenTypeList(
            int cellPhoneServiceProjectID)
        {
            if (cellPhoneServiceProjectID < 1)
                return null;
            return LoadEntities(t => t.CellPhoneServiceProjectID == cellPhoneServiceProjectID).ToList();
        }

        /// <summary>
        /// 获取可承保屏幕类型列表
        /// </summary>
        /// <param name="cellPhoneServiceProjectIDs">保险产品手机服务项目ID</param>
        /// <returns></returns>
        public List<InsuranceProductsAvailableScreenType> GetInsuranceProductsAvailableScreenTypeList(List<int> cellPhoneServiceProjectIDs)
        {
            if (cellPhoneServiceProjectIDs == null || !cellPhoneServiceProjectIDs.Any())
                return null;
            return LoadEntities(t => cellPhoneServiceProjectIDs.Contains(t.CellPhoneServiceProjectID)).ToList();
        }

        #region 删除保险产品所适用的屏幕类型列表 
        /// <summary>
        /// 删除保险产品所适用的屏幕类型列表
        /// </summary>
        /// <param name="insuranceProductsId">保险产品ID</param>
        /// <returns></returns>
        public bool DeleteInsuranceProductsAvailableScreenType(long insuranceProductsId)
        {
            string sql = "DELETE FROM InsuranceProductsAvailableScreenType WHERE InsuranceProductsID=@InsuranceProductsID";
            int re = ExcuteSql(sql, new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("InsuranceProductsID", insuranceProductsId) });
            return re > 0;
        }
        #endregion
    }
}
